﻿package plugin.npcDialog.ui.panels.boss
{
    import cmd.*;
    import com.sh.game.util.*;
    import flash.events.*;
    import manager.*;
    import plugin.newvip.model.*;
    import pluginfw.nio.*;
    import uiresource.npcdialogs.*;
    import view.message.*;

    public class BossCtrl2 extends BOSS2UI implements INpcDialogContent
    {
        private var _data:Object;

        public function BossCtrl2()
        {
            return;
        }// end function

        public function close() : void
        {
            if (this.parent)
            {
                this.parent.removeChild(this);
            }
            return;
        }// end function

        public function show(param1:Object, param2:Object) : void
        {
            this._data = param1;
            return;
        }// end function

        override protected function initializeView() : void
        {
            super.initializeView();
            Link_jinru.addEventListener(MouseEvent.CLICK, this.clickHandler);
            return;
        }// end function

        protected function clickHandler(event:MouseEvent) : void
        {
            var deliver:Object;
            var output:Output;
            var money:int;
            var event:* = event;
            deliver = ConfigDictionary.data.deliver[this._data.npcid][0];
            output = new Output();
            if (VipCheck.checkVipLevel() <= 0)
            {
                WarningManager.show(34, ["VIP"]);
                return;
            }
            if (VipCheck.checkVipLevel() < 2)
            {
                money = UserData.getBagData("money");
                if (money < 10)
                {
                    WarningManager.show(35, [10]);
                    return;
                }
                Alert2.show("是否花费 " + MColor.getHMTL("10", 6) + "元宝进入下一层！", "消费提示", ["确定", "取消"], function (param1:int, param2:Object) : void
            {
                if (param1 == 0)
                {
                    output.writeVarInt(deliver.stageid, false);
                    output.writeVarInt(deliver.x, false);
                    output.writeVarInt(deliver.y, false);
                    PluginManager.instance.sendToBufferServer("activity", CMDActivity.IntoBossInstance, output);
                }
                return;
            }// end function
            );
                return;
            }
            output.writeVarInt(deliver.stageid, false);
            output.writeVarInt(deliver.x, false);
            output.writeVarInt(deliver.y, false);
            PluginManager.instance.sendToBufferServer("activity", CMDActivity.IntoBossInstance, output);
            return;
        }// end function

        public function update(param1:Object, param2:int = 0) : void
        {
            return;
        }// end function

    }
}
